#ifndef SB_H
#define SB_H

#include <vector>
#include <list>
#include <stdlib.h>
#include <stdio.h>
#include "ListaAresta.h"
#include "ListaAtri.h"
#include "ListaClu.h"

using namespace std;

class SolucaoGRASPCobertura;

class Solucao{
	protected:
		char *saida;
	public:
		static int p; // Constante de nós a serem ativados.
		static int V;
		static int F;
		static double D;
		static double **linkClient;//[V][F]
		static bool **cobertura;//[V][F]
		static int *demanda;//[V]
		//Facilitadores que cobrem o cliente i 
		static vector< list<int> > *NF;
		//Cliente coberto pelo Facilitadores j 
		static vector< list<int> > *NV;
		

		//static double **fcLinkClient;//[tamanho][tamanho]
		//static double *auxLinkClient;//[tamanho]
		//static bool isInitGulosa;
		//Possui a lista dos custos cliente-steiner na ordem crescente
		//static ListaAresta *custoClientSteiner;
		
		//int *posATRI;//[tamanho]
        	//ListaAtri **tableATRI;
		
		/*Informacao de cada solucao.*/
		bool *solucao;//[F]
		int avaliacao;
		//indiquem que cobre o cliente i.
		int *c;//[V]
		
		
		//static bool isMaxDist;
		//double max_dist;
		//double atribuicao;
		
		//Separa as regi�es de aproximidade entres os clientes.
		static void initCluster();
		static void clearCluster();
		static double maiorDistancia;
		static ListaClu clusters;
		static ListaClu clusters2;
	
		static SolucaoGRASPCobertura* OptimizeCplex(double **distancias, int *demanda, int V, int F, int P, float Dc, list<int> &lCon, bool *out, int fmeta, SolucaoGRASPCobertura *sol);	
		//static SolucaoGRASPPMedian *OptimizeCplex(double **distancias, int V, int F, int P, list<int> &lCon, bool *out, double fmeta);
		//static SolucaoGRASPPMedian *MinimizeP(double **distancias, int V, int F, float Dmax);
		virtual void init() = 0;
		virtual int f() = 0;
		static void loadEntrada(char *fileName, int pIN, double cobertura);
		static void printEntrada();
		static void initGulosa();
		char *print();
		void printResultado();
		virtual ~Solucao(){
			if(this->solucao != NULL){
				delete this->solucao;
			}
			if(this->saida != NULL){
				delete this->saida;
			}
			/*if(this->posATRI != NULL){
                                delete this->posATRI;
                        }*/
			/*if(this->tableATRI != NULL){
                        	for(int i=0; i<tamanho; i++)
                                	delete this->tableATRI[i];
                                delete this->tableATRI;
			}*/
		}
		//Vetor contendo os tipos de cada localizacao
		static int *type; //[F]
		//Constantes que indicam o tipo da localizacao
		static const int CLIENT;
		static const int CLIENT_FACILITY;
		static const int FACILITY;
		static const int FACILITY_ACTIVE;
 
};

#endif
